package top.lshaci.learning.alibaba.cloud.seata.order.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import top.lshaci.learning.alibaba.cloud.seata.order.entity.Order;

/**
 * OrderMapper
 *
 * @author lshaci
 * @since 1.0.0
 */
public interface OrderMapper extends BaseMapper<Order> {
    /**
     * 从用户账户中借出
     *
     * @param userId 用户ID
     * @param money  借出金额
     */
    @Update("update account_tbl set money = money - #{money} where user_id = #{userId}")
    void create(@Param("userId") String userId, @Param("money") int money);
}
